-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Crash destroying imgui context in dynamic fonts branch #8653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry this is way too much code, you are not even providing details about the crash. I cannot magically guess what’s wrong without more details. |
Try to craft a minimal standardalone repro that exhibit the problem. |
In As for the unspecified crash: test in a debug build with assertions enabled. The exact location of the crash (or triggered assertion) is important, maybe even including the call stack and values of relevant variables. |
@GamingMinds-DanielC Thanks for the help. That code was in the part where ImGuiBackendFlags_RendererHasTextures is false, so it could not be the reason for the crash, but a bug is a bug and now is fixed :) I've solved the issue. The problem was here: ImFontConfig empty_font;
strcpy(empty_font.Name, "cpane");
empty_font.FontLoader=m_CustomLoader;
empty_font.SizePixels=m_FontSize;
imgui_io.Fonts->TexMinWidth=kTextureWidth;
imgui_io.Fonts->TexMinHeight=kTextureHeight;
empty_font.FontData=this; // <---------- BUG In the function void ImFontAtlasFontDestroySourceData() imgui frees the field FontData so my class was being freed and the rest of the destructor was handling corrupted data. Now I have added: empty_font.FontData=this;
empty_font.FontDataSize=sizeof(ComputerPane);
empty_font.FontDataOwnedByAtlas=false; And the game can close Ok. I'm not sure if this is the proper fix, I was doing this because I need to access the class from the callbacks of ImFontLoader. I tried to use the FontLoaderData member but there is an assert that makes sure that is null. I also tried to inherit from ImFontLoader but it did not work. What is the recommended way to do this? |
Version/Branch of Dear ImGui:
Version 1.92.0 WIP, Branch: dynamic_fonts
Back-ends:
Custom
Compiler, OS:
Windows 10 Visual Studio
Full config/build information:
Details:
Crash destroying imgui context
In my game I have a debug imgui and also some computers running imgui as UI. So, I have a debug context and may have several ingame contexts, they are not multi threaded. I attach a video showing three ingame imguis and later show the debug UI (in it you can see there are 14 ingame UIs).
The debug UI does not implement the ImGuiBackendFlags_RendererHasTextures but the ingame UIs do.
The debug UI does not have any issue that I'm aware of.
This is the code that creates the ingame UIs:
Some notes:
This is the code I use to destroy the ingame UIs:
The game crashes after calling this function while destroying the m_Parms member. But if I comment out this member then it crashes in another place. Also the game does not crash if I compile it with the docking branch.
Let me know if you need more information.
Carlos
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: